home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / WhatButton / WhatButton.m < prev    next >
Text File  |  1992-12-19  |  3KB  |  105 lines

  1.  
  2. /*    You may freely copy, distribute and reuse the code in this example.
  3.  *    Eric Tremblay disclaims any warranty of any kind, expressed or implied, as to
  4.  *    its fitness for any particular use.
  5.  *     May 31, 1992
  6.  */
  7.  
  8. /* Generated by Interface Builder */
  9.  
  10. #import "WhatButton.h"
  11. #import <appkit/Form.h> /* Used by the selectCellWithTag function */
  12. #import <appkit/Matrix.h> /* Used by the setTag:at:: function */
  13. #import <appkit/Button.h> /* Needed to button matrix */
  14.  
  15. @implementation WhatButton
  16.  
  17. -FindButton:sender
  18. /* This method checks what is the number of the tag of the current selected radio button */
  19. {
  20.    int WhichOne;
  21.    WhichOne = [ButtonBox selectedTag]; /* assigns the value of the currently selected button */
  22.    /* using tag as a reference */
  23.    
  24.    [NSelectedButton setIntValue:WhichOne]; /* display the value of the tag in the form */
  25.    
  26.    return self;
  27.  }
  28.  
  29. - selectButton0:sender
  30. /* This simply selects the proper radio button using the tag */
  31. {
  32.     [ButtonBox selectCellWithTag:0]; /* This will select radio button number 0 */ 
  33.     return self;
  34. }
  35.  
  36. - selectButton1:sender
  37. /* This simply selects the proper radio button using the tag */
  38. {
  39.     [ButtonBox selectCellWithTag:1]; /* This will select radio button number 1 */ 
  40.     return self;
  41. }
  42.  
  43. - selectButton2:sender
  44. /* This simply selects the proper radio button using the tag */
  45. {
  46.     [ButtonBox selectCellWithTag:2]; /* This will select radio button number 2 */ 
  47.     return self;
  48. }
  49.  
  50. - selectButton3:sender
  51. /* This simply selects the proper radio button using the tag */
  52. {
  53.     [ButtonBox selectCellWithTag:3]; /* This will select radio button number 3 */ 
  54.     return self;
  55. }
  56.  
  57. - selectButton4:sender
  58. /* This simply selects the proper radio button using the tag */
  59. {
  60.     [ButtonBox selectCellWithTag:4]; /* This will select radio button number 4 */ 
  61.     return self;
  62. }
  63.  
  64. - AddARadioButton:sender
  65. /* This method adds a new radio button to the ButtonBox matrixs */
  66. {
  67.     [ButtonBox insertRowAt:5]; /* Adds a new row to the radio button matrix */
  68.     [ButtonBox sizeToCells];  /* resizes the matrix frame to contain all the cells */
  69.     [ButtonBox display]; /* display the ButtonBox matrix */
  70.     return self;
  71.  }
  72.  
  73. - RemoveARadioButton:sender
  74. /* This method will remove a radio button from the ButtonBox matrix */
  75. {
  76.  
  77.    [ButtonBox removeRowAt:5 andFree:YES]; /* Remove a row from matrix and frees the cell */
  78.    [ButtonBox display]; /* display the ButtonBox matrix */
  79.    return self;
  80.  }
  81.  
  82. - ButtonA:sender
  83. /* This method simply displays which button was pressed in the ActionDisplay */
  84. {
  85.    [ActionDisplay setStringValue:"Button A Selected"];
  86.    return self;
  87.  }
  88.  
  89.  - ButtonB:sender
  90. /* This method simply displays which button was pressed in the ActionDisplay */
  91. {
  92.    [ActionDisplay setStringValue:"Button B Selected"];
  93.    return self;
  94.  }
  95.  
  96. - ButtonC:sender
  97. /* This method simply displays which button was pressed in the ActionDisplay */
  98. {
  99.    [ActionDisplay setStringValue:"Button C Selected"];
  100.    return self;
  101.  }
  102.  
  103.  
  104. @end
  105.